module App::Controller
    class DropWindow < Qt::Object
        slots 'modelColumnsModified()'

        # Needed for geometry save.
        attr_reader :view
        
        def initialize(main_window_controller, geo)
            super()
            
            toggl_tree_model = main_window_controller.model.tree

            @view = App::View::DropWindow.new(geo)
            @view.tv.setModel toggl_tree_model
            @treecontroller = App::Controller::TogglTree.new(@view.tv)

            connect @view.reload_button, SIGNAL(:triggered), toggl_tree_model, SLOT(:reload)
            connect @view.togglweb_button, SIGNAL(:triggered), main_window_controller, SLOT(:openToggl)
            sc = Qt::Shortcut.new Qt::KeySequence.new(Qt::Key_Escape), @view
            sc.connect(SIGNAL(:activated)) { toggl_tree_model.stop_all_tasks }
        end
    end
end

=begin NotUsedYet
class DropArea < Qt::Label
    slots 'clear()'
    signals 'changed(QString*)'

    def initialize(parent = nil)
        super(parent)
        setMinimumSize(200, 200)
        setFrameStyle(Qt::Frame::Sunken | Qt::Frame::StyledPanel)
        setAlignment(Qt::AlignCenter)
        setAcceptDrops(true)
        setAutoFillBackground(true)
    end

    def dragEnterEvent(event)
        setText(tr("<drop content>"))
        setBackgroundRole(Qt::Palette::Highlight)

        event.acceptProposedAction()
#	 emit changed(event.mimeData())
    end

    def dragMoveEvent(event)
        event.acceptProposedAction()
    end

    def dropEvent(event)
        mimeData = event.mimeData()
        if mimeData.hasText
            setText(mimeData.text())
            setTextFormat(Qt::PlainText)
        end

        formats = mimeData.formats()
        formats.each do |format|
            text = createPlainText(mimeData.data(format), format)
            if text.empty?
                setText(tr("No supported format"))
            else
                setText(text)
                break
            end
        end

        setBackgroundRole(Qt::Palette::Dark)
        event.acceptProposedAction()

        #puts text.inspect
        emit changed(text)
    end

    def dragLeaveEvent(event)
        clear()
        event.accept()
    end

    def clear()
        setText(tr("<drop content>"))
        setBackgroundRole(Qt::Palette::Dark)

        #emit changed(@mimeData)
    end
end
=end
